<template>
    <view>
        <u-navbar :title="title"></u-navbar>
        <view class="box">
            <u-parse :html="data"></u-parse>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            title: '',
            data: '',
        }
    },
    onLoad(option) {
        this.getDat(option.type);
    },
	onShow() {
		if (!uni.getStorageSync("user")) {
			uni.redirectTo({
				url:'/pages/my/login'
			})
		}
	},
    methods: {
        getDat(type) {
            this.$http({
                url: "api/common/get_agreement",
                data: {
                    name: type
                }
            }).then(res => {
                console.log(res);
                if (res.data.code == 1) {
                    this.data = res.data.data.content
                    this.title = res.data.data.title
                } else {
                    this.$tip.tip(res.data.msg)
                }
            }).catch(err => { });
        },
    }
}
</script>

<style>
.box {
    padding: 30rpx;
    box-sizing: border-box;
}
</style>